package com.teach.servlet.admin;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.teach.service.LjService;
import com.teach.service.impl.LjServiceImpl;

//@WebServlet("/admin/lj-delete.let")
public class LjDeleteServlet extends HttpServlet{

	private LjService ljService = new LjServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			Long id = Long.valueOf(request.getParameter("ljId"));
			ljService.delete(id);
			request.setAttribute("msg", "删除用户成功");
			request.setAttribute("href", "admin/lj-list.let");
		}catch(Exception e) {
			e.printStackTrace();
			request.setAttribute("erroe", "删除用户失败"+e.getMessage());
		}
		request.getRequestDispatcher("/admin/msg.jsp").forward(request, response);
	}
}
